package com.cskaoyan.wx.controller;

import com.cskaoyan.bean.Topic;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.wx.service.WxTopicService;
import com.cskaoyan.wx.vo.TopicDetailVO;
import com.cskaoyan.wx.vo.TopicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx")
public class WxTopicController {
    @Autowired
    WxTopicService wxTopicService;

    @GetMapping("topic/list")
    public BaseRespVo topicList(Integer page,Integer size){
        TopicVo topicVo = wxTopicService.getTopicList(page,size);
        return BaseRespVo.ok(topicVo);
    }

    @GetMapping("topic/related")
    public BaseRespVo topicRelated(Integer id){
        Topic topic = wxTopicService.getTopicRelated(id);
        return BaseRespVo.ok(topic);
    }

    @GetMapping("topic/detail")
    public BaseRespVo topicDetail(Integer id){
        TopicDetailVO topicDetailVO = wxTopicService.getTopicDetail(id);
        return BaseRespVo.ok(topicDetailVO);
    }
}
